package com.kaifamiao.entity;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kaifamiao.enums.Gender;
import com.kaifamiao.jackson.*;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;

import java.time.LocalDate;

@Data
@Table("t_users")
public class User {

    @Id
    private Integer id;
    private String account; // 账号
    private String email; // 邮箱
    private String tel; // 手机号
    @JsonSerialize(using = NullSerializer.class)
    private String password; // 密码
    @JsonSerialize(using = NullSerializer.class)
    private String salt; // 盐值
    private String nickname; // 昵称
    @JsonSerialize(using = GenderSerializer.class)
    @JsonDeserialize(using = GenderDeserializer.class)
    private Gender gender; // 性别
    @JsonSerialize(using = BirthdateSerializer.class)
    @JsonDeserialize(using = BirthdateDeserializer.class)
    private LocalDate birthdate; // 出生日期
    @JsonSerialize(using = BooleanSerializer.class)
    @JsonDeserialize(using = BooleanDeserializer.class)
    private boolean married; // 是否已婚
    @JsonSerialize(using = BooleanSerializer.class)
    @JsonDeserialize(using = BooleanDeserializer.class)
    private boolean admin; // 是否是管理员

}
